package com.lx.rpc.framework.protocol.factory;

import com.lx.rpc.framework.protocol.Protocol;
import com.lx.rpc.framework.protocol.http.HttpProtocol;

/**
 *
 * 协议工厂,通过配置的协议动态获取协议
 * @author wcy
 */
public class ProtocolFactory {


    public static Protocol getProtocol(){
        String protocolName = System.getProperty("protocolName");
        if(protocolName==null||protocolName.equals("")){
            protocolName = "http";
        }

        switch (protocolName){
            case "http":
                return new HttpProtocol();
            case "dubbo":
                break;
            default:
                return new HttpProtocol();
        }

        return new HttpProtocol();
    }
}
